import java.awt.Color;
import java.awt.Graphics;

public class Bullet {

	double xPos, yPos;

	double direction;

	double pixelsPerTick = 5.5;

	double xVel, yVel;

	int age;

	public void physics() {

		age++;

		xVel = 0;
		yVel = 0;

		double xDir, yDir;

		xDir = pixelsPerTick
				* Math.cos((direction % 360) / 360.0 * Math.PI * 2);
		yDir = pixelsPerTick
				* Math.sin((direction % 360) / 360.0 * Math.PI * 2);

		xVel += xDir;
		yVel += yDir;

		xPos += xVel;
		yPos += yVel;

	}

	Color shaftColor = new Color(192, 192, 64);

	Color featherColor = new Color(128, 96, 16);

	public void draw(Map gameMap, Graphics g) {

		// int xDir, yDir;
		//
		// xDir = (int) (xPos + 16 * Math.cos((direction % 360) / 360.0 *
		// Math.PI
		// * 2));
		// yDir = (int) (yPos + 16 * Math.sin((direction % 360) / 360.0 *
		// Math.PI
		// * 2));
		//
		// g.setColor(shaftColor);
		// gameMap.drawLine(g, (int) xPos, (int) yPos, (int) xDir, (int) yDir);

		g.setColor(featherColor);
		gameMap.fillOval(g, (int) xPos - 3, (int) yPos - 3, 6, 6);

	}

	public Bullet(double pos, double pos2, double direction,
			double pixelsPerTick) {
		super();
		xPos = pos;
		yPos = pos2;
		this.direction = direction;
		this.pixelsPerTick = pixelsPerTick;
	}
}
